home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1998 #1 / Amiga Plus 1998 #1.iso / demo-versionen / haage&partner / warpup-warpos / source / multitasking.p next >
Text File  |  1997-09-24  |  11KB  |  315 lines

  1.                 incdir  include:
  2.                 incdir  lvo:
  3.  
  4. **      '(C) Copyright 1997 Haage & Partner Computer GmbH'
  5. **           All Rights Reserved
  6.  
  7.                 include powerpc/ppcmacros.i
  8.                 include powerpc/powerpc.i
  9.                 include powerpc/tasksppc.i
  10.                 include dos/dos.i
  11.  
  12.                 include powerpc_lib.i
  13.                 include exec_lib.i
  14.                 include dos_lib.i
  15.  
  16.                 xref    _SysBase
  17.                 xref    _DOSBase
  18.                 xref    _PowerPCBase
  19.                 xref    _LinkerDB
  20.  
  21.                 smalldata
  22.                 executable
  23.                 escapestr
  24.                 version 8
  25.  
  26. start
  27.                 prolog  1024
  28.                 pushgpr r30/r31
  29.                 la      r31,TaskPtrs-4
  30.                 la      r4,Task1
  31.                 CALLPOWERPC     CreateTaskPPC
  32.                 stwu    r3,4(r31)
  33.                 la      r4,Task2
  34.                 CALLPOWERPC     CreateTaskPPC
  35.                 stwu    r3,4(r31)
  36.                 la      r4,Task3
  37.                 CALLPOWERPC     CreateTaskPPC
  38.                 stwu    r3,4(r31)
  39.                 la      r4,Task4
  40.                 CALLPOWERPC     CreateTaskPPC
  41.                 stwu    r3,4(r31)
  42.                 la      r4,Task5
  43.                 CALLPOWERPC     CreateTaskPPC
  44.                 stwu    r3,4(r31)
  45.                 la      r4,Task6
  46.                 CALLPOWERPC     CreateTaskPPC
  47.                 stwu    r3,4(r31)
  48.                 la      r4,Task7
  49.                 CALLPOWERPC     CreateTaskPPC
  50.                 stwu    r3,4(r31)
  51.                 la      r4,Task8
  52.                 CALLPOWERPC     CreateTaskPPC
  53.                 stwu    r3,4(r31)
  54.                 la      r4,Task9
  55.                 CALLPOWERPC     CreateTaskPPC
  56.                 stwu    r3,4(r31)
  57.                 la      _d1,welcome
  58.                 la      _d2,Args
  59.                 RUN68K_XL       _DOSBase,VPrintf
  60.                 liw     r4,SIGBREAKF_CTRL_C
  61.                 CALLPOWERPC     WaitPPC
  62.                 la      _d1,sendsigs
  63.                 la      _d2,Args
  64.                 RUN68K_XL       _DOSBase,VPrintf
  65.                 la      r31,TaskPtrs-4
  66.                 li      r30,9
  67. .loop
  68.                 lwzu    r4,4(r31)
  69.                 liw     r5,$00010000
  70.                 CALLPOWERPC     SignalPPC
  71.                 subic.  r30,r30,1
  72.                 bne     .loop
  73.                 liw     _d1,100
  74.                 RUN68K  _DOSBase,Delay
  75.                 popgpr
  76.                 epilog
  77.  
  78. T1_Code
  79.                 prolog  1024
  80.                 la      r3,T1_Win
  81.                 la      r4,T1_Text
  82.                 bl      Loop
  83.                 epilog
  84. T2_Code
  85.                 prolog  1024
  86.                 la      r3,T2_Win
  87.                 la      r4,T2_Text
  88.                 bl      Loop
  89.                 epilog
  90. T3_Code
  91.                 prolog  1024
  92.                 la      r3,T3_Win
  93.                 la      r4,T3_Text
  94.                 bl      Loop
  95.                 epilog
  96. T4_Code
  97.                 prolog  1024
  98.                 la      r3,T4_Win
  99.                 la      r4,T4_Text
  100.                 bl      Loop
  101.                 epilog
  102. T5_Code
  103.                 prolog  1024
  104.                 la      r3,T5_Win
  105.                 la      r4,T5_Text
  106.                 bl      Loop
  107.                 epilog
  108. T6_Code
  109.                 prolog  1024
  110.                 la      r3,T6_Win
  111.                 la      r4,T6_Text
  112.                 bl      Loop
  113.                 epilog
  114. T7_Code
  115.                 prolog  1024
  116.                 la      r3,T7_Win
  117.                 la      r4,T7_Text
  118.                 bl      Loop
  119.                 epilog
  120. T8_Code
  121.                 prolog  1024
  122.                 la      r3,T8_Win
  123.                 la      r4,T8_Text
  124.                 bl      Loop
  125.                 epilog
  126. T9_Code
  127.                 prolog  1024
  128.                 la      r3,T9_Win
  129.                 la      r4,T9_Text
  130.                 bl      Loop
  131.                 epilog
  132.  
  133. Loop
  134.                 pushlr
  135.                 pushgpr r27-r31
  136.                 mr      r27,r3
  137.                 mr      r28,r4
  138.                 li      r4,16
  139.                 CALLPOWERPC     AllocSignalPPC
  140.                 mr      r29,r3
  141.                 li      r4,1
  142.                 slw     r30,r4,r3
  143.                 mr      _d1,r27
  144.                 liw     _d2,MODE_NEWFILE
  145.                 RUN68K_XL       _DOSBase,Open
  146.                 mr      r31,_d0
  147. .loop
  148.                 mr      _d1,r31
  149.                 mr      _d2,r28
  150.                 la      _d3,Args
  151.                 RUN68K_XL       _DOSBase,VFPrintf
  152.                 li      r4,0
  153.                 li      r5,0
  154.                 CALLPOWERPC     SetSignalPPC
  155.                 and.    r3,r3,r30
  156.                 beq     .loop
  157.                 mr      _d1,r31
  158.                 la      _d2,sigsrec
  159.                 la      _d3,Args
  160.                 RUN68K_XL       _DOSBase,VFPrintf
  161.                 mr      r4,r29
  162.                 CALLPOWERPC     FreeSignalPPC
  163.                 popgpr
  164.                 epilog
  165.  
  166.                 section data
  167. welcome         dc.b    "Welcome to the WarpOS multitasking demonstration\n"
  168.                 dc.b    "Press CTRL-C to quit (The PPC will wait for CTRL_C itself!)\n",0
  169. sendsigs        dc.b    "Sending signals to all child tasks\n",0
  170. sigsrec         dc.b    "Signal received\n"
  171.                 dc.b    "Removing task\n",0
  172.                 even
  173.  
  174. Task1           dc.l    TASKATTR_CODE
  175.                 dc.l    T1_Code
  176.                 dc.l    TASKATTR_NAME
  177.                 dc.l    T1_Name
  178.                 dc.l    TASKATTR_R2
  179.                 dc.l    _LinkerDB
  180.                 dc.l    TASKATTR_MOTHERPRI
  181.                 dc.l    -1
  182.                 dc.l    0
  183. T1_Win          dc.b    "CON:0/0/266/200/PPC task 'DemoTask1'/AUTO/CLOSE/WAIT/INACTIVE",0
  184. T1_Text         dc.b    "PPC task 'DemoTask1' active\n"
  185.                 dc.b    "Waiting for a signal\n",0
  186. T1_Name         dc.b    "DemoTask1",0
  187.                 even
  188.  
  189. Task2           dc.l    TASKATTR_CODE
  190.                 dc.l    T2_Code
  191.                 dc.l    TASKATTR_NAME
  192.                 dc.l    T2_Name
  193.                 dc.l    TASKATTR_R2
  194.                 dc.l    _LinkerDB
  195.                 dc.l    TASKATTR_MOTHERPRI
  196.                 dc.l    -1
  197.                 dc.l    0
  198. T2_Win          dc.b    "CON:266/0/266/200/PPC task 'DemoTask2'/AUTO/CLOSE/WAIT/INACTIVE",0
  199. T2_Text         dc.b    "PPC task 'DemoTask2' active\n"
  200.                 dc.b    "Waiting for a signal\n",0
  201. T2_Name         dc.b    "DemoTask2",0
  202.                 even
  203.  
  204. Task3           dc.l    TASKATTR_CODE
  205.                 dc.l    T3_Code
  206.                 dc.l    TASKATTR_NAME
  207.                 dc.l    T3_Name
  208.                 dc.l    TASKATTR_R2
  209.                 dc.l    _LinkerDB
  210.                 dc.l    TASKATTR_MOTHERPRI
  211.                 dc.l    -1
  212.                 dc.l    0
  213. T3_Win          dc.b    "CON:532/0/266/200/PPC task 'DemoTask3'/AUTO/CLOSE/WAIT/INACTIVE",0
  214. T3_Text         dc.b    "PPC task 'DemoTask3' active\n"
  215.                 dc.b    "Waiting for a signal\n",0
  216. T3_Name         dc.b    "DemoTask3",0
  217.                 even
  218.  
  219. Task4           dc.l    TASKATTR_CODE
  220.                 dc.l    T4_Code
  221.                 dc.l    TASKATTR_NAME
  222.                 dc.l    T4_Name
  223.                 dc.l    TASKATTR_R2
  224.                 dc.l    _LinkerDB
  225.                 dc.l    TASKATTR_MOTHERPRI
  226.                 dc.l    -1
  227.                 dc.l    0
  228. T4_Win          dc.b    "CON:0/200/266/200/PPC task 'DemoTask4'/AUTO/CLOSE/WAIT/INACTIVE",0
  229. T4_Text         dc.b    "PPC task 'DemoTask4' active\n"
  230.                 dc.b    "Waiting for a signal\n",0
  231. T4_Name         dc.b    "DemoTask4",0
  232.                 even
  233.  
  234. Task5           dc.l    TASKATTR_CODE
  235.                 dc.l    T5_Code
  236.                 dc.l    TASKATTR_NAME
  237.                 dc.l    T5_Name
  238.                 dc.l    TASKATTR_R2
  239.                 dc.l    _LinkerDB
  240.                 dc.l    TASKATTR_MOTHERPRI
  241.                 dc.l    -1
  242.                 dc.l    0
  243. T5_Win          dc.b    "CON:266/200/266/200/PPC task 'DemoTask5'/AUTO/CLOSE/WAIT/INACTIVE",0
  244. T5_Text         dc.b    "PPC task 'DemoTask5' active\n"
  245.                 dc.b    "Waiting for a signal\n",0
  246. T5_Name         dc.b    "DemoTask5",0
  247.                 even
  248.  
  249. Task6           dc.l    TASKATTR_CODE
  250.                 dc.l    T6_Code
  251.                 dc.l    TASKATTR_NAME
  252.                 dc.l    T6_Name
  253.                 dc.l    TASKATTR_R2
  254.                 dc.l    _LinkerDB
  255.                 dc.l    TASKATTR_MOTHERPRI
  256.                 dc.l    -1
  257.                 dc.l    0
  258. T6_Win          dc.b    "CON:532/200/266/200/PPC task 'DemoTask6'/AUTO/CLOSE/WAIT/INACTIVE",0
  259. T6_Text         dc.b    "PPC task 'DemoTask6' active\n"
  260.                 dc.b    "Waiting for a signal\n",0
  261. T6_Name         dc.b    "DemoTask6",0
  262.                 even
  263.  
  264. Task7           dc.l    TASKATTR_CODE
  265.                 dc.l    T7_Code
  266.                 dc.l    TASKATTR_NAME
  267.                 dc.l    T7_Name
  268.                 dc.l    TASKATTR_R2
  269.                 dc.l    _LinkerDB
  270.                 dc.l    TASKATTR_MOTHERPRI
  271.                 dc.l    -1
  272.                 dc.l    0
  273. T7_Win          dc.b    "CON:0/400/266/200/PPC task 'DemoTask7'/AUTO/CLOSE/WAIT/INACTIVE",0
  274. T7_Text         dc.b    "PPC task 'DemoTask7' active\n"
  275.                 dc.b    "Waiting for a signal\n",0
  276. T7_Name         dc.b    "DemoTask7",0
  277.                 even
  278.  
  279. Task8           dc.l    TASKATTR_CODE
  280.                 dc.l    T8_Code
  281.                 dc.l    TASKATTR_NAME
  282.                 dc.l    T8_Name
  283.                 dc.l    TASKATTR_R2
  284.                 dc.l    _LinkerDB
  285.                 dc.l    TASKATTR_MOTHERPRI
  286.                 dc.l    -1
  287.                 dc.l    0
  288. T8_Win          dc.b    "CON:266/400/266/200/PPC task 'DemoTask8'/AUTO/CLOSE/WAIT/INACTIVE",0
  289. T8_Text         dc.b    "PPC task 'DemoTask8' active\n"
  290.                 dc.b    "Waiting for a signal\n",0
  291. T8_Name         dc.b    "DemoTask8",0
  292.                 even
  293.  
  294. Task9           dc.l    TASKATTR_CODE
  295.                 dc.l    T9_Code
  296.                 dc.l    TASKATTR_NAME
  297.                 dc.l    T9_Name
  298.                 dc.l    TASKATTR_R2
  299.                 dc.l    _LinkerDB
  300.                 dc.l    TASKATTR_MOTHERPRI
  301.                 dc.l    -1
  302.                 dc.l    0
  303. T9_Win          dc.b    "CON:532/400/266/200/PPC task 'DemoTask10'/AUTO/CLOSE/WAIT/INACTIVE",0
  304. T9_Text         dc.b    "PPC task 'DemoTask9' active\n"
  305.                 dc.b    "Waiting for a signal\n",0
  306. T9_Name         dc.b    "DemoTask9",0
  307.                 even
  308.  
  309.                 section bss
  310.                 ds.b    32
  311. Args            ds.l    1
  312. TaskPtrs        dsb.l   9
  313.                 ds.b    32
  314.                 even
  315.